package com.alks.function.data.vo.finance.lotcost;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alks.common.utils.BigDecimalUtil;
import com.alks.common.utils.excelUtils.nestExcel.convert.DateConvert;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author: chen
 * @date: 2024/12/20
 * @description: 补单费用
 */
@Data
@ApiModel(value = "补单费用")
public class SupplementDutyVO {

    @ApiModelProperty(value = "补料单号")
    private String slipNo;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @ExcelProperty(converter = DateConvert.class)
    @ApiModelProperty(value = "开补日期")
    private LocalDateTime slipDate;

    @ApiModelProperty(value = "开补单位")
    private String dutyDeptName;

    @ApiModelProperty(value = "材料金额")
    private BigDecimal dutyAmt;

    @ApiModelProperty(value = "人工金额")
    private BigDecimal laborAmt;

    @ApiModelProperty(value = "合计")
    private BigDecimal totalAmt;

    @ApiModelProperty(value = "外协金额")
    private BigDecimal amt;

    public BigDecimal getDutyAmt() {
        return BigDecimalUtil.numberScale(dutyAmt, 2);
    }

    public BigDecimal getLaborAmt() {
        return BigDecimalUtil.numberScale(laborAmt, 2);
    }

    public BigDecimal getAmt() {
        return BigDecimalUtil.numberScale(amt, 2);
    }

    public BigDecimal getTotalAmt() {
        return BigDecimalUtil.numberScale(BigDecimalUtil.add(this.dutyAmt, this.laborAmt), 2);
    }
}
